<!DOCTYPE html>



  


<html class="theme-next gemini use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="theme-color" content="#222">



  
  
    
    
  <script src="/lib/pace/pace.min.js?v=1.0.2"></script>
  <link href="/lib/pace/pace-theme-minimal.min.css?v=1.0.2" rel="stylesheet">







<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />







<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.4" rel="stylesheet" type="text/css" />


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=5.1.4">


  <link rel="mask-icon" href="/images/logo.svg?v=5.1.4" color="#222">





  <meta name="keywords" content="csipsimple," />





  <link rel="alternate" href="/atom.xml" title="搁浅丶岁月的变迁" type="application/atom+xml" />






<meta name="description" content="1.配置,数据初始化service.SipWakeLock         acquire         72            锁定wifi  service.SipWakeLock         release         84            释放wifi  db.DBProvider         onCreate         268">
<meta name="keywords" content="csipsimple">
<meta property="og:type" content="article">
<meta property="og:title" content="5.调试---安装，注册">
<meta property="og:url" content="http://yoursite.com/2017/12/25/2017-12-25-5.调试---安装，注册/index.html">
<meta property="og:site_name" content="搁浅丶岁月的变迁">
<meta property="og:description" content="1.配置,数据初始化service.SipWakeLock         acquire         72            锁定wifi  service.SipWakeLock         release         84            释放wifi  db.DBProvider         onCreate         268">
<meta property="og:locale" content="zh-Hans">
<meta property="og:updated_time" content="2018-05-28T08:47:48.249Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="5.调试---安装，注册">
<meta name="twitter:description" content="1.配置,数据初始化service.SipWakeLock         acquire         72            锁定wifi  service.SipWakeLock         release         84            释放wifi  db.DBProvider         onCreate         268">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Gemini',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://yoursite.com/2017/12/25/2017-12-25-5.调试---安装，注册/"/>





  <title>5.调试---安装，注册 | 搁浅丶岁月的变迁</title>
  








</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>
    <a href="https://github.com/liaoren512"><img style="position: absolute; top: 0; left: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_left_red_aa0000.png" alt="Fork me on GitHub"></a>
    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">搁浅丶岁月的变迁</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle">没有虽败犹荣，只有成王败寇。</p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      

      
        <li class="menu-item menu-item-search">
          
            <a href="javascript:;" class="popup-trigger">
          
            
              <i class="menu-item-icon fa fa-search fa-fw"></i> <br />
            
            搜索
          </a>
        </li>
      
    </ul>
  

  
    <div class="site-search">
      
  <div class="popup search-popup local-search-popup">
  <div class="local-search-header clearfix">
    <span class="search-icon">
      <i class="fa fa-search"></i>
    </span>
    <span class="popup-btn-close">
      <i class="fa fa-times-circle"></i>
    </span>
    <div class="local-search-input-wrapper">
      <input autocomplete="off"
             placeholder="搜索..." spellcheck="false"
             type="text" id="local-search-input">
    </div>
  </div>
  <div id="local-search-result"></div>
</div>



    </div>
  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://yoursite.com/2017/12/25/2017-12-25-5.调试---安装，注册/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="廖壬">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/ichgo.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="搁浅丶岁月的变迁">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">5.调试---安装，注册</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2017-12-25T00:00:00+08:00">
                2017-12-25
              </time>
            

            

            
          </span>

          

          
            
          

          
          

          
            <span class="post-meta-divider">|</span>
            <span class="page-pv"><i class="fa fa-file-o"></i>
            <span class="busuanzi-value" id="busuanzi_value_page_pv" ></span>
            </span>
          

          
            <div class="post-wordcount">
              
                
                <span class="post-meta-item-icon">
                  <i class="fa fa-file-word-o"></i>
                </span>
                
                  <span class="post-meta-item-text">字数统计&#58;</span>
                
                <span title="字数统计">
                  
                </span>
              

              
                <span class="post-meta-divider">|</span>
              

              
                <span class="post-meta-item-icon">
                  <i class="fa fa-clock-o"></i>
                </span>
                
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                
                <span title="阅读时长">
                  
                </span>
              
            </div>
          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <h2 id="1-配置-数据初始化"><a href="#1-配置-数据初始化" class="headerlink" title="1.配置,数据初始化"></a>1.配置,数据初始化</h2><pre><code>service.SipWakeLock         acquire         72            锁定wifi

service.SipWakeLock         release         84            释放wifi

db.DBProvider         onCreate         268                    初始数据提供

service.DeviceStateReceiver         onReceive         49    根据数据状态变化,更改网络

pjsip.PjSipService         resetCodecs         1011        重置存储编解码器列表

service.PreferenceProvider         onCreate         67        配置信息提供
</code></pre><h2 id="2-创建Activity-装入Fragment"><a href="#2-创建Activity-装入Fragment" class="headerlink" title="2.创建Activity,装入Fragment"></a>2.创建Activity,装入Fragment</h2><pre><code>ui.SipHome         onCreate         188                        Activity创建

ui.SipHome$TabsAdapter         &lt;init&gt;         525                初始化页面适配器

ui.SipHome$TabsAdapter         addTab         534                添加一个Fragment    1

ui.SipHome$TabsAdapter         onTabSelected         581        当Tab被选中的时候添加对应的Fragment

ui.SipHome$TabsAdapter         clearDetails         652        清除Fragment

ui.SipHome$TabsAdapter         getCount         568            查询Fragment数量

ui.SipHome$TabsAdapter         addTab         534                添加一个Fragment    2

ui.SipHome$TabsAdapter         addTab         534                添加一个Fragment    3

ui.SipHome$TabsAdapter         addTab         534                添加一个Fragment    4

ui.SipHome         selectTabWithAction         1147        根据Action加载Tab
</code></pre><h2 id="3-注册"><a href="#3-注册" class="headerlink" title="3.注册"></a>3.注册</h2><pre><code>ui.SipHome         register         430                        注册

ui.SipHome         getBranchInfo         311                    获取注册信息

ui.SipHome         onResume         1010                    获得焦点

service.PreferenceProvider         update         133            更新到DB

ui.SipHome         sendFragmentVisibilityChange         698    设置目前选择的Fragment可见

ui.SipHome         getFragmentAt         671                    返回当前Fragment

ui.SipHome$TabsAdapter         getIdForPosition         550    返回Fragment对应的id号

ui.SipHome         onPause         994                        失去焦点

ui.SipHome         onCreateOptionsMenu         1239        创建Menu菜单

ui.SipHome         startSipService         826                启动服务监控

ui.SipHome         applyTheme         1046                    设置主题

ui.SipHome         postStartSipService         843            开启设置,注册
                                                        注册广播接收器
service.SipService$ServiceHandler         &lt;init&gt;     1776    初始化Handle
</code></pre><h2 id="4-启动Sip服务"><a href="#4-启动Sip服务" class="headerlink" title="4.启动Sip服务"></a>4.启动Sip服务</h2><pre><code>service.SipService         onCreate         1084            创建Sip服务

service.SipNotifications         &lt;init&gt;         78            初始化通知

service.SipWakeLock         &lt;init&gt;         42                锁初始化

                            registerServiceBroadcasts                注册广播接收器

service.SipService         onStart         1252            启动Sip服务 1

service.SipService         registerForOutgoing         1305注册?

service.SipService         isConnectivityValid     1336    当前的连接是否有效

pjsip.PjSipService         setService         147                pj添加SipSever对象

service.SipService         getPrefs         1654            返回preferenceWrapper

pjsip.PjSipService         tryToLoadStack         158            加载Stack 2

service.SipService$SipServiceExecutor     execute 1941    启动线程再次加载Stack 3

service.SipService         startSipStack         1383        加载Stack 3

service.SipService         isConnectivityValid         1336当前的连接是否有效

pjsip.PjSipService         sipStart         200                启动SIP栈 4
</code></pre><h2 id="5-发送广播"><a href="#5-发送广播" class="headerlink" title="5.发送广播"></a>5.发送广播</h2><pre><code>service.SipWakeLock         &lt;init&gt;         42                wake锁初始化

pjsip.UAStateReceiver         initService         906        接收公有配置

pjsip.UAStateReceiver$WorkerHandler &lt;init&gt;         745        WorkerHandler初始化

pjsip.UAStateReceiver         reconfigure         956        重新配置call,play

pjsip.ZrtpStateReceiver         &lt;init&gt;         40            接收Zrtp状态

service.MediaManager         &lt;init&gt;         101                初始化媒体

service.MediaManager         startService         118        启动媒体服务

service.SipService         getPrefs         1654            返回preferenceWrapper

service.MediaManager         onBluetoothStateChanged 803 蓝牙状态,发送媒体广播

service.MediaManager         setSoftwareVolume         589    设置声音

service.SipService         getPrefs         1654            返回preferenceWrapper

service.MediaManager         broadcastMediaChanged 619    发送媒体广播

service.SipService         getPrefs         1654            返回preferenceWrapper

service.receiver.DynamicReceiver4         &lt;init&gt;         92    接收SipServer广播

service.receiver.DynamicReceiver4 startMonitoring 279     启动广播

service.SipService         getPrefs         1654            返回preferenceWrapper
</code></pre><h2 id="6-接收广播"><a href="#6-接收广播" class="headerlink" title="6.接收广播"></a>6.接收广播</h2><pre><code>service.receiver.DynamicReceiver4         onReceive 98    接受广播

service.SipService$AccountStatusContentObserver 1015    初始化用户状态观察者

api.SipProfile         &lt;init&gt;         1034                    创建用户包装类

pjsip.PjSipService         addAccount         826                添加账号

pjsip.PjSipAccount         &lt;init&gt;         75                    从SipProfile取信息

pjsip.PjSipAccount         applyExtraParams         258        添加特定参数

pjsip.PjSipService         getProfileState         977        返回动态SIP模式状态

api.SipProfileState         isAddedToStack         535        是否把账号加入Stack

api.SipProfileState         setAddedStatus         455        设置addedStatus

api.SipProfileState         setPjsuaId         368            设置pjsuaId

api.SipProfileState         createFromContentValue     270    从content读取账号

service.SipService$AccountStatusContentObserver 1019    观察者: 账号状态改变

service.SipService         updateRegistrationsState 1597    更新注册状态

api.SipProfileState createFromContentValue         270        从content读取账号

api.SipProfileState         isValidForCall         544        账号呼叫是否有效

api.SipProfileState         isAddedToStack         535        是否把账号加入Stack

api.SipProfileState         getComparator         559        返回优先级高的账号

service.SipNotifications         cancelRegisters     478    取消注册

service.SipWakeLock         release         84            释放锁

service.SipService$     handleMessage         1951        接收消息

service.SipService$SipRunnable         run         2083    运行线程

service.SipService         confAdjustTxLevel         1665    调整TX软件音量

service.SipWakeLock         release         84            释放锁

service.SipService handleMessage         1951            接受消息

service.SipService$SipRunnable         run         2083    运行线程

service.receiver.DynamicReceiver4$1     doRun     103        接受广播,激活锁

service.SipService         isConnectivityValid     1336    当前的连接是否有效

service.SipService$ServicePhoneStateReceiver 1063        call状态改变

service.SipService$handleMessage         1951            接受消息

service.SipService$SipRunnable         run         2083    运行线程

pjsip.PjSipService     updateProfileStateFromService 933    同步content到stack

pjsip.PjSipService         getAccountIdForPjsipId         1786

db.DBProvider         update         651
</code></pre><h2 id="7-更新界面"><a href="#7-更新界面" class="headerlink" title="7.更新界面"></a>7.更新界面</h2><pre><code>service.SipService    onChange 1019                        用户状态改变

service.SipService     updateRegistrationsState     1597    更新注册状态

api.SipProfileState         createFromContentValue     270 从content读取账号

api.SipProfileState         isValidForCall         544        账号呼叫是否有效

api.SipProfileState         isAddedToStack         535        是否把账号加入Stack

service.SipWakeLock         release         84            释放锁

api.SipProfileState         getComparator         559        返回优先级高的账号

service.SipNotifications notifyRegisteredAccounts 227    通知注册帐号
</code></pre><h2 id="8-第一安装-启动向导"><a href="#8-第一安装-启动向导" class="headerlink" title="8.第一安装,启动向导"></a>8.第一安装,启动向导</h2><pre><code>api.SipProfileState         getWizard         394            返回向导

api.SipProfileState         getDisplayName         491        返回显示名

点击保存

service.PreferenceProvider         update         133            更新到content

ui.SipHome         onResume         1010                    获得焦点

ui.SipHome         sendFragmentVisibilityChange     698        设置目前选择的Fragment可见

ui.SipHome$TabsAdapter         getIdForPosition     550        返回Fragment对应的id号

ui.dialpad.DialerFragment     onVisibilityChanged 890        可见状态改变

ui.dialpad.DialerFragment         onResume         280        获得焦点
</code></pre><h2 id="9-绑定Fragment"><a href="#9-绑定Fragment" class="headerlink" title="9.绑定Fragment"></a>9.绑定Fragment</h2><pre><code>ui.dialpad.DialerFragment         onAttach         361        绑定DialerFragment

service.SipService         onBind         1365                其他intent绑定到service

ui.SipHome         onAttachFragment         713                绑定

ui.SipHome$TabsAdapter         getIdForPosition         550    返回Fragment对应的id号

ui.dialpad.DialerFragment         onVisibilityChanged 890    可见状态改变

ui.dialpad.DialerFragment         onCreate         177        创建DialerFragment

ui.dialpad.DialerFragment         onCreateView         195    监听事件,初始化界面

ui.dialpad.DialerLayout         &lt;init&gt;         71            布局初始化

api.SipProfileState     createFromContentValue         270    从content读取账号

api.SipProfileState         isActive         411            返回用户状态

api.SipProfileState         isAddedToStack         535        是否把账号加入Stack

ui.dialpad.DialerFragment$3         onChooseAccount 418    选择账户

ui.SipHome         onAttachFragment         713                绑定Fragment

ui.SipHome$TabsAdapter         getIdForPosition         550 返回Fragment对应的id号

ui.calllog.CallLogListFragment         onCreateView     103    创建通话履历

ui.calllog.CallLogListFragment         onViewCreated     110    事件监听

ui.SipHome         onResume         1010                    获得焦点

service.PreferenceProvider         update         133

ui.SipHome         sendFragmentVisibilityChange         698 设置目前选择的Fragment可见

ui.SipHome         getFragmentAt         671                    返回Fragment对应的id号

ui.dialpad.DialerFragment         onVisibilityChanged 890    可见状态改变

ui.dialpad.DialerFragment         onResume         280        拨号盘获得焦点

ui.dialpad.DialerFragment$1 onServiceConnected 131        服务连接

ui.SipHome         onCreateOptionsMenu         1239        创建Menu菜单

ui.dialpad.DialerFragment     onCreateOptionsMenu     652 创建Menu菜单

service.SipService$3         onReceive         1157        接受注册广播

service.SipService         unregisterForOutgoing         1311注销

service.SipService         isConnectivityValid         1336当前的连接是否有效

ui.dialpad.DialerFragment         onDetach         382        销毁Fragment
</code></pre>
      
    </div>
    
    
    

    <div>
      
        <div>
    
        <div style="text-align:center;color: #ccc;font-size:14px;">-------------本文结束<i class="fa fa-paw"></i>感谢您的阅读-------------</div>
    
</div>

      
    </div>

    

    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <!--<a href="/tags/csipsimple/" rel="tag"># csipsimple</a>-->
            <a href="/tags/csipsimple/" rel="tag"><i class="fa fa-tag"></i> csipsimple</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2017/12/25/2017-12-25-6.连接github/" rel="next" title="6.连接github">
                <i class="fa fa-chevron-left"></i> 6.连接github
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2017/12/25/2017-12-25-5.忽略特殊文件/" rel="prev" title="5.忽略特殊文件">
                5.忽略特殊文件 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
        <!-- JiaThis Button BEGIN -->
<div class="jiathis_style">
<span class="jiathis_txt">分享到：</span>
<a class="jiathis_button_fav">收藏夹</a>
<a class="jiathis_button_copy">复制网址</a>
<a class="jiathis_button_email">邮件</a>
<a class="jiathis_button_weixin">微信</a>
<a class="jiathis_button_qzone">QQ空间</a>
<a class="jiathis_button_tqq">腾讯微博</a>
<a class="jiathis_button_douban">豆瓣</a>
<a class="jiathis_button_share">一键分享</a>

<a href="http://www.jiathis.com/share?uid=2140465" class="jiathis jiathis_txt jiathis_separator jtico jtico_jiathis" target="_blank">更多</a>
<a class="jiathis_counter_style"></a>
</div>
<script type="text/javascript" >
var jiathis_config={
  data_track_clickback:true,
  summary:"",
  shortUrl:false,
  hideMore:false
}
</script>
<script type="text/javascript" src="http://v3.jiathis.com/code/jia.js?uid=" charset="utf-8"></script>
<!-- JiaThis Button END -->
      
    </div>
  </div>


          </div>
          


          

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image"
                src="/images/ichgo.jpg"
                alt="廖壬" />
            
              <p class="site-author-name" itemprop="name">廖壬</p>
              <p class="site-description motion-element" itemprop="description">Learn to choose, to forsake, to endure loneliness, to resist temptation.</p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/archives/">
              
                  <span class="site-state-item-count">391</span>
                  <span class="site-state-item-name">日志</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-categories">
                <a href="/categories/index.html">
                  <span class="site-state-item-count">11</span>
                  <span class="site-state-item-name">分类</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-tags">
                <a href="/tags/index.html">
                  <span class="site-state-item-count">56</span>
                  <span class="site-state-item-name">标签</span>
                </a>
              </div>
            

          </nav>

          
            <div class="feed-link motion-element">
              <a href="/atom.xml" rel="alternate">
                <i class="fa fa-rss"></i>
                RSS
              </a>
            </div>
          

          
            <div class="links-of-author motion-element">
                
                  <span class="links-of-author-item">
                    <a href="https://github.com/liaoren512" target="_blank" title="GitHub">
                      
                        <i class="fa fa-fw fa-github"></i>GitHub</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="mailto:liaoren512@gmail.com" target="_blank" title="E-Mail">
                      
                        <i class="fa fa-fw fa-envelope"></i>E-Mail</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="https://weibo.com/5281757990/profile?rightmod=1&wvr=6&mod=personinfo" target="_blank" title="Weibo">
                      
                        <i class="fa fa-fw fa-globe"></i>Weibo</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="https://www.zhihu.com" target="_blank" title="Zhihu">
                      
                        <i class="fa fa-fw fa-globe"></i>Zhihu</a>
                  </span>
                
            </div>
          

          
          

          
          

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-配置-数据初始化"><span class="nav-number">1.</span> <span class="nav-text">1.配置,数据初始化</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-创建Activity-装入Fragment"><span class="nav-number">2.</span> <span class="nav-text">2.创建Activity,装入Fragment</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-注册"><span class="nav-number">3.</span> <span class="nav-text">3.注册</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#4-启动Sip服务"><span class="nav-number">4.</span> <span class="nav-text">4.启动Sip服务</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#5-发送广播"><span class="nav-number">5.</span> <span class="nav-text">5.发送广播</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#6-接收广播"><span class="nav-number">6.</span> <span class="nav-text">6.接收广播</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#7-更新界面"><span class="nav-number">7.</span> <span class="nav-text">7.更新界面</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#8-第一安装-启动向导"><span class="nav-number">8.</span> <span class="nav-text">8.第一安装,启动向导</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#9-绑定Fragment"><span class="nav-number">9.</span> <span class="nav-text">9.绑定Fragment</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        
<!--<script async src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>-->

<div class="copyright">&copy; <span itemprop="copyrightYear">2018</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">廖壬</span>

  
</div>

<!-- 在网站底部加上访问量-->
<!--<div class="powered-by">
<i class="fa fa-user-md"></i><span id="busuanzi_container_site_uv">
  本站访客数:<span id="busuanzi_value_site_pv"></span>
</span>
</div>-->
<!--pv的方式，单个用户连续点击n篇文章，记录n次访问量-->
<!--

  <div class="powered-by">由 <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a> 强力驱动</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题 &mdash; <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Gemini</a> v5.1.4</div>



-->
<div class="theme-info">
  <div class="powered-by"></div>
  <span class="post-count">博客全站共字</span>
</div>
        
<div class="busuanzi-count">
  <script async src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>

  
    <span class="site-uv">
      <i class="fa fa-user"></i>
      <span class="busuanzi-value" id="busuanzi_value_site_uv"></span>
      
    </span>
  

  
    <span class="site-pv">
      <i class="fa fa-eye"></i>
      <span class="busuanzi-value" id="busuanzi_value_site_pv"></span>
      
    </span>
  
</div>








        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  


  



  
  









  
  
    <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  

  
  
    <script type="text/javascript" src="/lib/canvas-nest/canvas-nest.min.js"></script>
  

  
  
    <script type="text/javascript" src="/lib/three/three.min.js"></script>
  

  
  
    <script type="text/javascript" src="/lib/three/three-waves.min.js"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.4"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=5.1.4"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.1.4"></script>



  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  












  

  <script type="text/javascript">
    // Popup Window;
    var isfetched = false;
    var isXml = true;
    // Search DB path;
    var search_path = "search.xml";
    if (search_path.length === 0) {
      search_path = "search.xml";
    } else if (/json$/i.test(search_path)) {
      isXml = false;
    }
    var path = "/" + search_path;
    // monitor main search box;

    var onPopupClose = function (e) {
      $('.popup').hide();
      $('#local-search-input').val('');
      $('.search-result-list').remove();
      $('#no-result').remove();
      $(".local-search-pop-overlay").remove();
      $('body').css('overflow', '');
    }

    function proceedsearch() {
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay"></div>')
        .css('overflow', 'hidden');
      $('.search-popup-overlay').click(onPopupClose);
      $('.popup').toggle();
      var $localSearchInput = $('#local-search-input');
      $localSearchInput.attr("autocapitalize", "none");
      $localSearchInput.attr("autocorrect", "off");
      $localSearchInput.focus();
    }

    // search function;
    var searchFunc = function(path, search_id, content_id) {
      'use strict';

      // start loading animation
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay">' +
          '<div id="search-loading-icon">' +
          '<i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>' +
          '</div>' +
          '</div>')
        .css('overflow', 'hidden');
      $("#search-loading-icon").css('margin', '20% auto 0 auto').css('text-align', 'center');

      $.ajax({
        url: path,
        dataType: isXml ? "xml" : "json",
        async: true,
        success: function(res) {
          // get the contents from search data
          isfetched = true;
          $('.popup').detach().appendTo('.header-inner');
          var datas = isXml ? $("entry", res).map(function() {
            return {
              title: $("title", this).text(),
              content: $("content",this).text(),
              url: $("url" , this).text()
            };
          }).get() : res;
          var input = document.getElementById(search_id);
          var resultContent = document.getElementById(content_id);
          var inputEventFunction = function() {
            var searchText = input.value.trim().toLowerCase();
            var keywords = searchText.split(/[\s\-]+/);
            if (keywords.length > 1) {
              keywords.push(searchText);
            }
            var resultItems = [];
            if (searchText.length > 0) {
              // perform local searching
              datas.forEach(function(data) {
                var isMatch = false;
                var hitCount = 0;
                var searchTextCount = 0;
                var title = data.title.trim();
                var titleInLowerCase = title.toLowerCase();
                var content = data.content.trim().replace(/<[^>]+>/g,"");
                var contentInLowerCase = content.toLowerCase();
                var articleUrl = decodeURIComponent(data.url);
                var indexOfTitle = [];
                var indexOfContent = [];
                // only match articles with not empty titles
                if(title != '') {
                  keywords.forEach(function(keyword) {
                    function getIndexByWord(word, text, caseSensitive) {
                      var wordLen = word.length;
                      if (wordLen === 0) {
                        return [];
                      }
                      var startPosition = 0, position = [], index = [];
                      if (!caseSensitive) {
                        text = text.toLowerCase();
                        word = word.toLowerCase();
                      }
                      while ((position = text.indexOf(word, startPosition)) > -1) {
                        index.push({position: position, word: word});
                        startPosition = position + wordLen;
                      }
                      return index;
                    }

                    indexOfTitle = indexOfTitle.concat(getIndexByWord(keyword, titleInLowerCase, false));
                    indexOfContent = indexOfContent.concat(getIndexByWord(keyword, contentInLowerCase, false));
                  });
                  if (indexOfTitle.length > 0 || indexOfContent.length > 0) {
                    isMatch = true;
                    hitCount = indexOfTitle.length + indexOfContent.length;
                  }
                }

                // show search results

                if (isMatch) {
                  // sort index by position of keyword

                  [indexOfTitle, indexOfContent].forEach(function (index) {
                    index.sort(function (itemLeft, itemRight) {
                      if (itemRight.position !== itemLeft.position) {
                        return itemRight.position - itemLeft.position;
                      } else {
                        return itemLeft.word.length - itemRight.word.length;
                      }
                    });
                  });

                  // merge hits into slices

                  function mergeIntoSlice(text, start, end, index) {
                    var item = index[index.length - 1];
                    var position = item.position;
                    var word = item.word;
                    var hits = [];
                    var searchTextCountInSlice = 0;
                    while (position + word.length <= end && index.length != 0) {
                      if (word === searchText) {
                        searchTextCountInSlice++;
                      }
                      hits.push({position: position, length: word.length});
                      var wordEnd = position + word.length;

                      // move to next position of hit

                      index.pop();
                      while (index.length != 0) {
                        item = index[index.length - 1];
                        position = item.position;
                        word = item.word;
                        if (wordEnd > position) {
                          index.pop();
                        } else {
                          break;
                        }
                      }
                    }
                    searchTextCount += searchTextCountInSlice;
                    return {
                      hits: hits,
                      start: start,
                      end: end,
                      searchTextCount: searchTextCountInSlice
                    };
                  }

                  var slicesOfTitle = [];
                  if (indexOfTitle.length != 0) {
                    slicesOfTitle.push(mergeIntoSlice(title, 0, title.length, indexOfTitle));
                  }

                  var slicesOfContent = [];
                  while (indexOfContent.length != 0) {
                    var item = indexOfContent[indexOfContent.length - 1];
                    var position = item.position;
                    var word = item.word;
                    // cut out 100 characters
                    var start = position - 20;
                    var end = position + 80;
                    if(start < 0){
                      start = 0;
                    }
                    if (end < position + word.length) {
                      end = position + word.length;
                    }
                    if(end > content.length){
                      end = content.length;
                    }
                    slicesOfContent.push(mergeIntoSlice(content, start, end, indexOfContent));
                  }

                  // sort slices in content by search text's count and hits' count

                  slicesOfContent.sort(function (sliceLeft, sliceRight) {
                    if (sliceLeft.searchTextCount !== sliceRight.searchTextCount) {
                      return sliceRight.searchTextCount - sliceLeft.searchTextCount;
                    } else if (sliceLeft.hits.length !== sliceRight.hits.length) {
                      return sliceRight.hits.length - sliceLeft.hits.length;
                    } else {
                      return sliceLeft.start - sliceRight.start;
                    }
                  });

                  // select top N slices in content

                  var upperBound = parseInt('1');
                  if (upperBound >= 0) {
                    slicesOfContent = slicesOfContent.slice(0, upperBound);
                  }

                  // highlight title and content

                  function highlightKeyword(text, slice) {
                    var result = '';
                    var prevEnd = slice.start;
                    slice.hits.forEach(function (hit) {
                      result += text.substring(prevEnd, hit.position);
                      var end = hit.position + hit.length;
                      result += '<b class="search-keyword">' + text.substring(hit.position, end) + '</b>';
                      prevEnd = end;
                    });
                    result += text.substring(prevEnd, slice.end);
                    return result;
                  }

                  var resultItem = '';

                  if (slicesOfTitle.length != 0) {
                    resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + highlightKeyword(title, slicesOfTitle[0]) + "</a>";
                  } else {
                    resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + title + "</a>";
                  }

                  slicesOfContent.forEach(function (slice) {
                    resultItem += "<a href='" + articleUrl + "'>" +
                      "<p class=\"search-result\">" + highlightKeyword(content, slice) +
                      "...</p>" + "</a>";
                  });

                  resultItem += "</li>";
                  resultItems.push({
                    item: resultItem,
                    searchTextCount: searchTextCount,
                    hitCount: hitCount,
                    id: resultItems.length
                  });
                }
              })
            };
            if (keywords.length === 1 && keywords[0] === "") {
              resultContent.innerHTML = '<div id="no-result"><i class="fa fa-search fa-5x" /></div>'
            } else if (resultItems.length === 0) {
              resultContent.innerHTML = '<div id="no-result"><i class="fa fa-frown-o fa-5x" /></div>'
            } else {
              resultItems.sort(function (resultLeft, resultRight) {
                if (resultLeft.searchTextCount !== resultRight.searchTextCount) {
                  return resultRight.searchTextCount - resultLeft.searchTextCount;
                } else if (resultLeft.hitCount !== resultRight.hitCount) {
                  return resultRight.hitCount - resultLeft.hitCount;
                } else {
                  return resultRight.id - resultLeft.id;
                }
              });
              var searchResultList = '<ul class=\"search-result-list\">';
              resultItems.forEach(function (result) {
                searchResultList += result.item;
              })
              searchResultList += "</ul>";
              resultContent.innerHTML = searchResultList;
            }
          }

          if ('auto' === 'auto') {
            input.addEventListener('input', inputEventFunction);
          } else {
            $('.search-icon').click(inputEventFunction);
            input.addEventListener('keypress', function (event) {
              if (event.keyCode === 13) {
                inputEventFunction();
              }
            });
          }

          // remove loading animation
          $(".local-search-pop-overlay").remove();
          $('body').css('overflow', '');

          proceedsearch();
        }
      });
    }

    // handle and trigger popup window;
    $('.popup-trigger').click(function(e) {
      e.stopPropagation();
      if (isfetched === false) {
        searchFunc(path, 'local-search-input', 'local-search-result');
      } else {
        proceedsearch();
      };
    });

    $('.popup-btn-close').click(onPopupClose);
    $('.popup').click(function(e){
      e.stopPropagation();
    });
    $(document).on('keyup', function (event) {
      var shouldDismissSearchPopup = event.which === 27 &&
        $('.search-popup').is(':visible');
      if (shouldDismissSearchPopup) {
        onPopupClose();
      }
    });
  </script>





  

  

  

  
  

  

  

  

</body>
</html>
<!-- 页面点击小红心 -->
<script type="text/javascript" src="/js/src/love.js"></script>